package com.yz.Graph;

import javax.swing.*;

//给定年利润，贷款的钱数，并计算每年还款钱数
public class GuiText03 {
    public static void main(String[] args) {
        String annualProfit = JOptionPane.showInputDialog(null, "Enter yearly rate:");
        //System.out.println(money);
        //将输入进来的年利润转换成浮点型
        double annualProfitDouble = Double.parseDouble(annualProfit);

        //贷款钱数
        String loan_commitment = JOptionPane.showInputDialog(null, "loan commitment");
        int loanCommitment = Integer.parseInt(loan_commitment);

        //贷款年数
        String loan_years = JOptionPane.showInputDialog(null, "Loan years");
        int LoanYears= Integer.parseInt(loan_years);

        Double year = annualProfitDouble*loanCommitment*LoanYears;
        Double month = (annualProfitDouble*loanCommitment)/12;
        String info = "Total outstanding loans:"+year+"\n"+"Monthly repayment limit:"+month;
        JOptionPane.showMessageDialog(null,info);


    }
}
